<%--
  Created by IntelliJ IDEA.
  User: Shinelon
  Date: 2018-06-05
  Time: 10:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/table/bootstrap-table.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/table/bootstrap-table.min.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/statics/table/locale/bootstrap-table-zh-CN.min.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/date/Moment.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/statics/date/bootstrap-datetimepicker.min.js"></script>

<!--mini ui-->
<%--<link href="${pageContext.request.contextPath}/statics/miniui/miniui.css" rel="stylesheet"--%>
<%--type="text/css"/>--%>
<%--<script src="${pageContext.request.contextPath}/statics/miniui/miniui.js"--%>
<%--type="text/javascript"></script>--%>


<%--win10-ui--%>
<script type="text/javascript" src="${pageContext.request.contextPath}/win10-ui/js/win10.child.js"></script>

<!--easyui-->
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/statics/easyui/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/statics/easyui/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/statics/easyui/demo.css">

<script type="text/javascript" src="${pageContext.request.contextPath}/statics/easyui/jquery.easyui.min.js"></script>

<%--sweetalert--%>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/statics/sweetalert/sweetalert.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/sweetalert/sweetalert.min.js"></script>



<!--自己-->

<link href="${pageContext.request.contextPath}/statics/css/jinhuo.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/tuihuo.js"></script>


<script>

    function ll() {
        var arr = $("#lin1").bootstrapTable('getData');
        var hao = new Array()
        var number = new Array()


        $.each(arr,function (i,e) {

            hao[i] = arr[i].id;
            number[i] = arr[i].number;
        })
        $.post("${pageContext.request.contextPath}/lin/upd",{"s":JSON.stringify(hao),"num":JSON.stringify(number)},function (data) {
            $("#biao").bootstrapTable("load", data);
            var arr1 = $("#biao").bootstrapTable('getData');
            var zhong = 0;
            $.each(arr1,function(i,e){
                var sum = arr1[i].sum;
                var qian = arr1[i].bprice;
                zhong+=sum*qian;
            })

            $("#zhong").text(zhong);
        });




        $("#lin1").bootstrapTable('removeAll');
        $("#myModal").modal("hide");

    }
    function dell() {
        var arr = $("#biao").bootstrapTable('getAllSelections');
        if (arr.length == 0) {
            alert("你没有选中任何商品");
        } else {

            if(confirm("您确定要删除这些商品吗？")){
                $.each(arr, function(i, e) {

                    $.post("${pageContext.request.contextPath}/lin/del", {
                        "id" : e.id
                    }, function(date) {

                        $("#biao").bootstrapTable("load", date);

                        var arr1 = $("#biao").bootstrapTable('getData');
                        var zhong = 0;
                        $.each(arr1,function(i,e){
                            var sum = arr1[i].sum;
                            var qian = arr1[i].bprice;
                            zhong+=sum*qian;
                        })

                        $("#zhong").text(zhong);
                    });
                });
            }else{
                alert("你取消的删除！")
            }
        }
    }

</script>

<html>
<head>
    <title>Title</title>
</head>
<body>
<%--标题--%>
<nav class="navbar navbar-inverse" role="navigation">
    <div class="container-fluid">
        <div>
            <ul id="myTab" class="nav navbar-nav" >
                <li class="active"><a href="#home" data-toggle="tab">仓库退货</a></li>
                <li><a href="#gonghuoqinkuang" data-toggle="tab">退货查询</a></li>
            </ul>
        </div>
    </div>
</nav>
<br>

<%--标题内容--%>
<div id="myTabContent" class="tab-content">
    <%--供货商所有单据的内容--%>
    <div class="tab-pane fade in active" id="home">

        <div id="div">
            <div id="tt">
                <p><span class="h3">退货出库</span></p>
            </div>
            <div>
                <p class="text-right" style="color: red">退货单号：<span id="order">${order}</span>&emsp;&emsp;&emsp;</p>
            </div>
            <div class="jin">&emsp;&emsp;
                <div>
                    供货商：
                    <input id="ghs" class="easyui-combogrid" style="width:200px" data-options="
			panelWidth: 500,
			idField: 'id',
			textField: 'name',
			url: '${pageContext.request.contextPath}/supp/query',
			method: 'get',
			columns: [[
				{field:'id',title:'供货商id',width:100},
				{field:'name',title:'供货商名称',width:150},
				{field:'ming',title:'联系人',width:120},
				{field:'phone',title:'手机号',width:180},
				{field:'address',title:'供货商地址',width:200},
			]],
			fitColumns: true
		">

                </div>
                <div>
                    仓库：<input id="ck" class="easyui-combogrid" style="width:200px" data-options="
			panelWidth: 500,
			idField: 'id',
			textField: 'name',
			url: '${pageContext.request.contextPath}/war/query',
			method: 'get',
			columns: [[
				{field:'id',title:'仓库id',width:100},
				{field:'name',title:'仓库名称',width:150},
				{field:'ming',title:'负责人',width:120},
				{field:'phone',title:'手机号',width:180},
				{field:'address',title:'仓库地址',width:200},
			]],
			fitColumns: true
		">
                </div>
                <div>
                    日期：
                    <div class="input-group date" id="datetimepicker10" style=" width:235px; height: 30px;">
                        <input id="time" type="text" class="form-control" style="padding-top: 4px;padding-bottom: 4px;height: 30px;">
                        <span class="input-group-addon" style="
                padding-top: 4px;
                padding-bottom: 4px;
                height: 30px;
            ">
                    <span class="glyphicon glyphicon-calendar">
                    </span>
                </span>
                    </div>
                </div>


            </div>
            <div class="jin">&emsp;&emsp;
                <button type="button" onclick="tui()" class="btn btn-default">添加退货货品</button>
                <button type="button" onclick="dan()" class="btn btn-default">整单退货</button>
                <button type="button" onclick="dell()" class="btn btn-default right" >删除</button>
            </div>
            <div id="boo">
                <table id="biao"></table>
            </div>

            <div class="jin2">
                <p>退货金额 ￥<span style="color: red;" id="zhong"></span>&emsp;&emsp;&emsp;经办人：<input id="jbr" class="easyui-combogrid" style="width:200px" data-options="
			panelWidth: 500,
			idField: 'id',
			textField: 'name',
			url: '${pageContext.request.contextPath}/staff/listjin',
			method: 'get',
			columns: [[
				{field:'id',title:'员工编号',width:100},
				{field:'name',title:'员工姓名',width:150},
				{field:'zhiwu',title:'职务',width:120},
				{field:'phone',title:'联系电话',width:180},
				{field:'address',title:'联系地址',width:200},
			]],
			fitColumns: true
		">

                </p>
                <div style="display: inline-block;width: 100%;text-align: right;margin-bottom: 20px;margin-top: -10px;">
                    <button type="button" onclick="save2()" style="text-align: right;margin-right: 20px" class="btn btn-default">提交退货单</button>
                </div>
            </div>

        </div>


    </div>

    <%--供货商供货情况表的内容--%>
    <div class="tab-pane fade" id="gonghuoqinkuang">

    </div>

</div>


<!--老货物添加-->
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div style="width: 1200px;" class="modal-dialog" role="document">
        <div   class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">新增货品</h4>
            </div>
            <div style="height:650px" class="modal-body">
                <div style="width: 575px;height:  600px; display: inline-block;" class="zuo1">
                    <form class="form-inline">
                        <div class="form-group">
                            <input id="name" type="text" class="form-control" placeholder="搜索内容">
                        </div>
                        <div class="form-group">
                            <input id="lei" class="easyui-combogrid" style="width:200px" data-options="
                                        panelWidth: 300,
                                        idField: 'id',
                                        textField: 'name',
                                        url: '${pageContext.request.contextPath}/commtype/list',
                                        method: 'get',
                                        columns: [[
                                            {field:'id',title:'类别id',width:100},
                                            {field:'name',title:'分类名称',width:150},
                                        ]],
                                        fitColumns: true
                                    ">
                        </div>
                        <button onclick="search()" type="button" class="btn btn-default">查询</button>
                    </form>
                    <table id="jiu2"></table>
                </div>
                <div style="margin-left:5px ;width: 575px;background-color: #FFFFFF;height: 600px; display: inline-block" class="you1">
                    <table id="lin1"></table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">退出</button>
                <button type="button" onclick="ll()" class="btn btn-primary">确认</button>
            </div>
        </div>
    </div>
</div>



<%--整单退货--%>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div style="width: 1200px;" class="modal-dialog" role="document">
        <div   class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel1">整单退货</h4>
            </div>
            <div style="height:650px" class="modal-body">
                <!--功能面板-->


                        <%--查询--%>
                        <form class="form-inline">
                            <%--按时间查询--%>
                            <div  class="input-group input-daterange" style="float: left">
                                <input id="firstDate" type="text" class="form-control">
                                <div class="input-group-addon">到：</div>
                                <input id="secondDate" type="text" class="form-control">
                            </div>
                            &nbsp;

                            <%--按供货商查询--%>
                            供货商名称:
                            <input id="supplierr" class="easyui-combogrid" style="width:200px" data-options="
			                    panelWidth: 500,
			                    idField: 'id',
			                    textField: 'name',

			                    url: '${pageContext.request.contextPath}/supp/query',
			                    method: 'get',
			                    columns: [[
				                        {field:'id',title:'供货商id',width:100},
				                        {field:'name',title:'供货商名称',width:150},
				                        {field:'ming',title:'联系人',width:120},
				                        {field:'phone',title:'手机号',width:180},
				                        {field:'address',title:'供货商地址',width:200},
			                    ]],
			                    fitColumns: true
		                    ">

                            <button onclick="tome()" type="button" class="btn btn-default">查询</button>
                        </form>

                    <table id="table"></table>



            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">退出</button>
                <button type="button" onclick="ll()" class="btn btn-primary">确认</button>
            </div>
        </div>
    </div>
</div>

<!--双击添加-->
<!-- Modal -->
<input type="hidden" id="lei1">
<input type="hidden" id="yan1">
<input type="hidden" id="dan1">

<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div style="width: 500px;" class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel2">货品信息（商品入库）</h4>
            </div>
            <div style="height: 200px;" class="modal-body">
                <!--上部-->
                <div style="width: 100%;height: 140px;" id="shang">

                    <div style="display:inline-block; margin-left: -20px; width:228px;" class="jdzuo">
                        <ul>
                            <li style="font-size: 18px;list-style:none;">货品编号:&emsp;<span id="hpbh">1</span></li>
                            <li style="font-size: 18px;list-style:none;">规格型号:&emsp;<span id="ggxh">2</span></li>
                            <li style="font-size: 18px;list-style:none;">类&emsp;&emsp;别:&emsp;<span id="lb">3</span></li>
                            <li style="font-size: 18px;list-style:none;">当前库存:&emsp;<span id="dqkc">4</span></li>
                        </ul>

                    </div>
                    <div style="margin-left:-30px;display:inline-block; width:230px;" class="jdyou">
                        <ul style="width:290px;">
                            <li style="font-size: 18px;list-style:none;">货品名称:&emsp;<span id="hpmc">1</span></li>
                            <li style="font-size: 18px;list-style:none;">单&emsp;&emsp;位:&emsp;<span id="dw">2</span></li>
                            <li style="font-size: 18px;list-style:none;">颜&emsp;&emsp;色:&emsp;<span id="ys">3</span></li>
                            <li style="font-size: 18px;list-style:none;">出库价格:&emsp;<span id="ckjg">4</span></li>
                        </ul>
                    </div>

                </div>
                <p style="font-size: 16px;">上次进价:&emsp;<span id="scjj"></span>&emsp;退货价格：&emsp;<input style="width: 70px;" type="text" id="ckjj">&emsp;数量：&emsp;<input style="width: 70px;" type="text" id="sum" value="1"></p>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="ddd" onclick="ti1()" class="btn btn-primary">确认</button>
            </div>
        </div>
    </div>
</div>













</body>
<script type="text/javascript">
    $(function(){
        var timeout=setTimeout(function () {
            var arr1 = $("#biao").bootstrapTable('getData');
            var zhong = 0;
            $.each(arr1,function(i,e){
                var sum = arr1[i].sum;
                var qian = arr1[i].bprice;
                zhong+=sum*qian;
            })

            $("#zhong").text(zhong);
        }, 10);
        $.post("${pageContext.request.contextPath}/commtype/list",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#xuan').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        $.post("${pageContext.request.contextPath}/comp/query",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#dw1').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })
        $.post("${pageContext.request.contextPath}/color/query",function (releset) {
            var e=releset;
            $(e).each(function (i,e) {
                $('#ys1').append('<option value='+e.id+' >'+e.name+'</option>');
            })
        })


    })
</script>
</html>
